# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AlertCenter.V1beta1.Model.ActivityRule do
  @moduledoc """
  Alerts from Google Workspace Security Center rules service configured by an admin.

  ## Attributes

  *   `actionNames` (*type:* `list(String.t)`, *default:* `nil`) - List of action names associated with the rule threshold.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Rule create timestamp.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Description of the rule.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Alert display name.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Rule name.
  *   `query` (*type:* `String.t`, *default:* `nil`) - Query that is used to get the data from the associated source.
  *   `supersededAlerts` (*type:* `list(String.t)`, *default:* `nil`) - List of alert IDs superseded by this alert. It is used to indicate that this alert is essentially extension of superseded alerts and we found the relationship after creating these alerts.
  *   `supersedingAlert` (*type:* `String.t`, *default:* `nil`) - Alert ID superseding this alert. It is used to indicate that superseding alert is essentially extension of this alert and we found the relationship after creating both alerts.
  *   `threshold` (*type:* `String.t`, *default:* `nil`) - Alert threshold is for example “COUNT > 5”.
  *   `triggerSource` (*type:* `String.t`, *default:* `nil`) - The trigger sources for this rule. * GMAIL_EVENTS * DEVICE_EVENTS * USER_EVENTS
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp of the last update to the rule.
  *   `windowSize` (*type:* `String.t`, *default:* `nil`) - Rule window size. Possible values are 1 hour or 24 hours.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :actionNames => list(String.t()) | nil,
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :name => String.t() | nil,
          :query => String.t() | nil,
          :supersededAlerts => list(String.t()) | nil,
          :supersedingAlert => String.t() | nil,
          :threshold => String.t() | nil,
          :triggerSource => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :windowSize => String.t() | nil
        }

  field(:actionNames, type: :list)
  field(:createTime, as: DateTime)
  field(:description)
  field(:displayName)
  field(:name)
  field(:query)
  field(:supersededAlerts, type: :list)
  field(:supersedingAlert)
  field(:threshold)
  field(:triggerSource)
  field(:updateTime, as: DateTime)
  field(:windowSize)
end

defimpl Poison.Decoder, for: GoogleApi.AlertCenter.V1beta1.Model.ActivityRule do
  def decode(value, options) do
    GoogleApi.AlertCenter.V1beta1.Model.ActivityRule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AlertCenter.V1beta1.Model.ActivityRule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
